/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package baiwa.rta.service.Impl;

import baiwa.rta.dao.WarningLetterDao;
import baiwa.rta.model.DataTableModel;
import baiwa.rta.model.RMwnltModel;
import baiwa.rta.service.WarningLetterService;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 *
 * @author jirapatjantsakool
 */
@Service("WarningLetterService")
public class WarningLetterServiceImpl implements WarningLetterService{
    
    @Autowired WarningLetterDao dao;

    @Override
    public List<RMwnltModel> getAllWarningLetter() {
        return dao.findAll();
    }

    @Override
    public RMwnltModel getWarningLetterById(Integer wnltid) {
        return dao.findById(wnltid);
    }

    @Override
    @Transactional
    public void save(RMwnltModel model) throws Exception {
        dao.create(model);
    }

    @Override
    @Transactional
    public boolean update(RMwnltModel model) {
        return dao.update(model);
    }

    @Override
    @Transactional
    public boolean delete(RMwnltModel model) {
        return dao.delete(model);
    }

    @Override
    public DataTableModel<RMwnltModel> getCarStickerDataTable(RMwnltModel model, int iDisplayStart, int iDisplayLength) {
        return dao.findDataTable(model, iDisplayStart, iDisplayLength);
    }
    
}
